package cn.silver.module.monitor.bean;

import cn.silver.framework.core.utils.DateUtils;
import cn.silver.framework.log.event.OperEvent;
import cn.silver.framework.mybatis.bean.BaseBean;
import cn.silver.module.monitor.domain.LogOper;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;


/**
 * 操作日志记录视图对象 sys_oper_log
 *
 * @author Silver Zhou
 */
@Data
@NoArgsConstructor
@ExcelIgnoreUnannotated
@AutoMappers({
        @AutoMapper(target = OperEvent.class),
        @AutoMapper(target = LogOper.class)
})
@EqualsAndHashCode(callSuper = true)
@Schema(name = "LogOperModel", title = "用户操作信息对象")
public class LogOperBean extends BaseBean implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户主键
     */
    @Schema(title = "用户主键")
    private String userId;

    /**
     * 登录账号
     */
    @Schema(title = "登录账号")
    private String userCode;

    /**
     * 用户姓名
     */
    @Schema(title = "用户姓名")
    private String userName;

    /**
     * 模块标题
     */
    @Schema(title = "模块编码")
    private String moduleCode;

    /**
     * 模块标题
     */
    @Schema(title = "模块标题")
    private String moduleName;

    /**
     * 业务类型
     */
    @Schema(title = "业务类型")
    private String busType;

    @Schema(title = "操作类型")
    private String operType;

    @Schema(title = "设备类型")
    private String deviceType;
    /**
     * 主机地址
     */
    @Schema(title = "主机地址")
    private String clientIp;

    /**
     * 客户端编码
     */
    @Schema(title = "客户端编码")
    private String clientCode;

    /**
     * 请求URL
     */
    @Schema(title = "请求URL")
    private String reqUrl;

    /**
     * 请求方式
     */
    @Schema(title = "请求方式")
    private String reqMethod;

    /**
     * 请求参数
     */
    @Schema(title = "请求参数")
    private String reqParam;

    /**
     * 请求结果
     */
    @Schema(title = "请求结果")
    private String result;

    /**
     * 返回参数
     */
    @Schema(title = "返回参数")
    private String jsonResult;

    /**
     * 操作时间
     */
    @Schema(title = "操作时间")
    @JsonFormat(timezone = DateUtils.TIME_ZONE, pattern = DateUtils.YYYY_MM_DD_HH_MM_SS)
    private Date operTime;

    /**
     * 消耗时间
     */
    @Schema(title = "消耗时间")
    private Long costTime;

    /**
     * 租户编号
     */
    @Schema(title = "租户编号")
    private String tenantId;
}
